package com.kayt.cyberBar.company.business.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.kayt.cyberBar.common.ServerResponse;
import com.kayt.cyberBar.company.business.entity.po.BCompanyAccount;
import com.kayt.cyberBar.company.business.entity.vo.CompanyAccountListVO;
import com.kayt.cyberBar.company.business.entity.vo.CompanyAccountVO;
import com.kayt.cyberBar.company.business.server.ICompanyAccountServer;
import com.kayt.cyberBar.company.business.service.ICompanyAccountService;

@Service("iCompanyAccountService")
public class CompanyAccountServiceImpl implements ICompanyAccountService {

	@Autowired
	private ICompanyAccountServer iCompanyAccountServer;
	
	@Override
	public ServerResponse<CompanyAccountVO> addAccount () {
		BCompanyAccount account = this.iCompanyAccountServer.add_account();
		return this.iCompanyAccountServer.assemble_result(account);
	}
	
	@Override
	public ServerResponse<String> updateAccount (CompanyAccountVO vo) {
		int result = this.iCompanyAccountServer.update_account(vo);
		return this.iCompanyAccountServer.assemble_result_string(result);
	}
	
	@Override
	public ServerResponse<String> deleteAccount (String code) {
		int result = this.iCompanyAccountServer.delete_account_by_code(code);
		return this.iCompanyAccountServer.assemble_result_string(result);
	}
	
	@Override
	public ServerResponse<CompanyAccountVO> getAccount (CompanyAccountVO vo) {
		BCompanyAccount result = this.iCompanyAccountServer.get_account(vo);
		return this.iCompanyAccountServer.assemble_result(result);
	}
	
	@Override
	public ServerResponse<String> addAccountList (CompanyAccountListVO vo) {
		int result = this.iCompanyAccountServer.add_account_map_list(vo);
		return this.iCompanyAccountServer.assemble_result_string(result);
	}
	
}
